CHANGING CONTRAST ANYWHERE!!!
#1
Posted 17 August 2003 - 01:27 PM
I have just got Macromedia Flash MX and soon I'll release my first real website. I'll put up my 'new generation' of games. I just finished making Collapse (it's so fast!) and going on to make Sprite, which I might enter for the competition (a 3D shoot-em up game).
Some programming tips:
1. VERY USEFUL - If you have more than 4 subsequent 'test'=>'operation' codes in your program, use If, IfEnd and else to seperate them into groups of 2. For example say you want to show letters on the screen...
If A<5
Then If A<3
Then A=1=>"A"
A=2=>"B"
Else A=3=>"C"
A=4=>"D"
IfEnd
Else If A<7
Then A=5=>"E"
A=6=>"F"
Else A=7=>"G"
A=8=>"H"
IfEnd
IfEnd
This makes the above code 2x faster than simply putting them all in a line!
2. You don't need to close [{ and ( brackets in most cases. Exceptions are: before =<> and in an equation.
3. Try to arrange your labels so that you don't have so many jumps around the whole program.
4. Logical operations slow things down, if testing two values, try and combine them into one test.
5. Don't use special effects on your programs, they take up too much memory, all we want is the gameplay and special effects take up too much memory and speed.
btw, does anyone know the fastest way to make A become 2 if it's 1 and A become 1 if it's 2. If you put them in order, it will always end up as 1.
#2
Posted 17 August 2003 - 02:42 PM
That comes in the manual, once I realized that in my AFX, and when I published here Crimson informed to me that it was not a newness...
And when I bought the AFX the first that I made was read the manual...
BTW: Nice programmation tips.
#3
Posted 17 August 2003 - 04:07 PM
Yeah, you're not the first person revealing this trick in the forum.I'll risk the embarassment of reporting something you may know but on my CFX, I can change the contrast anywhere on the calculator, wherever it is waiting for input (all except the menu)
But I found more useful thing about it (maybe some of you haven't tried it yet). In programs yuo can make a turn off option. Yuo have to e.g. check if player types F6' /> and call a triangle (-disp- function) if he does. Then player can turn off calculator without breaking program.
I'm not sure what do you mean.btw, does anyone know the fastest way to make A become 2 if it's 1 and A become 1 if it's 2. If you put them in order, it will always end up as 1.
Maybe this:
not (A-1)+1->A
#4
Posted 17 August 2003 - 10:54 PM
A=1=>2->A
A=2=>1->A
you could do as endi said or if you prefer you can use:
If A=1
Then 2->A
Else A=2=>1->A
End If
#5
Posted 18 August 2003 - 07:15 AM
No need to be embarassed, i didn't knowI'll risk the embarassment of reporting something you may know but on my CFX, I can change the contrast anywhere on the calculator
#6
Posted 18 August 2003 - 08:37 AM
A=1=>2->A A=2=>1->A
then all that will happen is that is a = 1 the first line will set a to 2, but the second line will the ask if a = 2, which it will do, and change it back to 1!
the code Endi suggested will work though!
#7
Posted 18 August 2003 - 02:01 PM
thats what I was saying...
#8
Posted 18 August 2003 - 02:07 PM
#9
Posted 18 August 2003 - 11:31 PM
2(A=1) + (A=2)-> A
no one talk about that... I discovered it one day by accident that's really useful!
Edited by 2072, 18 August 2003 - 11:58 PM.
#10
Posted 18 August 2003 - 11:40 PM
#11
Posted 18 August 2003 - 11:52 PM
(A=1)+1->A
will put A to 1 if A=0 and then the cycle begin 1 2 1 2 1 2...
in C it would be
A=(A==1) +1;
That trick is useful to make 2 states switches.
#12
Posted 18 August 2003 - 11:57 PM
Ooops you response that doubt when i was writting this reply.
#13
Posted 19 August 2003 - 12:04 AM
#14
Posted 19 August 2003 - 02:57 AM
you can also extend it to If ()+()+()...=... Then... (or >=...) etc.
#15
Posted 19 August 2003 - 06:59 AM
1. For + or -1 AND + or -2 use Isz and Dsz, it takes up less/equal memory and it's faster. +3 is the same as Isz, Isz, Isz but the second way takes up more memory. And don't put zero's in numbers less than 0.
2. See if you can get a better one but my trademark 'pause' in programs without the -Disp- symbol is Do:LpWhile Getkey=/=31.
3. Try to stay away from letter inputs in programs, it's cool but allowing a user to select something from a list is easier. Speaking of lists, F1' /> ---, F2' /> --- is a lot easier to program than using an arrow that can move up and down.
Is it possible to make 3D games in text mode? Post any tips or favorite ways of doing something.
EDIT
So I'm a Casio Addict now am I?
#16
Posted 19 August 2003 - 07:53 AM
i've got a question, sometimes, the Isz and Dsz commands muck up my program. they don't seem to always work. ??????1. For + or -1 AND + or -2 use Isz and Dsz, it takes up less/equal memory and it's faster. +3 is the same as Isz, Isz, Isz but the second way takes up more memory. And don't put zero's in numbers less than 0.
2. See if you can get a better one but my trademark 'pause' in programs without the -Disp- symbol is Do:LpWhile Getkey=/=31.
Or perhaps it's just me.
Also, your pause method is similar to the one i use, however, i don't use it often as i create games which don't require a pause (RPG). yet, a while ago i added a pause to the original version of Indy, as in that game it was needed.
#17
Posted 19 August 2003 - 09:06 AM
program
[code=auto:0]
4->S
LBL 1
DEC S
IF S=-2
THEN "HALLO"
ENDIF
GOTO 1
[/CODE ]
It will crash as if S=0 then there is no IF but only an end if in the loop (since the if line is NOT executed!)
This can mess up the whole program so be carefull when and how you use these commands.
One other thing:
Insted of large numbers use the ENG Symbols!
1000 = 1k
1000000 = 1M
0.001 = 1m
and so on, this saves a lot of memory and makes the whole source code clearer.
#18
Posted 19 August 2003 - 09:31 AM
#19
Posted 19 August 2003 - 01:46 PM
well, I like compresion... I guess my favorite trick is puting every little thing in seperate programs, using them like C functions. It saves space by alowing for code reuse, and it makes your programs run faster.
#20
Posted 19 August 2003 - 04:16 PM
I'll risk the embarassment of reporting something you may know but on my CFX, I can change the contrast anywhere on the calculator
No need to be embarassed, i didn't know
i didnt know either
#21
Posted 19 August 2003 - 06:29 PM
Good trick, I use the sam way, with LpWhile
I also use the ENG and Norm commands to make eng. programs, like one called "C" (I hope that this program will be available in the andy davies website, its for ceramic capacitor's codes) , its so usefull.
I think that i'm not a good programmer because much work costs to me to reduce the code of my programs, I need more practice
#22
Posted 20 August 2003 - 10:04 AM
The main thing that interests me is splitting your programs up to make them run faster.
Does this really work, I mean can you split a slow game into a hundred parts to run super fast? Cause if you can then people should be able to make real cool programs, only problem is then people would have the right to complain about too many programs in one game !
#23
Posted 20 August 2003 - 10:14 AM
#24
Posted 20 August 2003 - 10:21 AM
over large distances this might be true but else not! Be aware that the OS / Basic interpreter has to do
the folowing things to load another program:
*store name and current position of old program
*search new program
*Set pointer to this program
*Execute
*Search old program
*Move pointer to position where new program was called.
try replacing the folowing
0->D FOR 1-A TO 1000 ISZ D NEXT
by:
PROG1: 0->D FOR 1-A TO 1000 PRGM "PROG2" NEXT PROG2 ISZ D
And messure the time they take to run!
The second form will be slower (and this will be better visible if you replace the 1000 by 1M
#25
Posted 20 August 2003 - 10:52 AM
if A<>A
Then Prog "IMPOS"
EndIf
than:
If A<>A
then "This"
"wont"
"happen"
EndIf
since it only has to scan/skip one line.
#26
Posted 21 August 2003 - 03:33 AM
I executed an instruction 1000 times & took the time. I did this three times calculated the middle value and
divided it by 1000. And subtracted 0.00554 (the time on for loop takes, i messured it before without instructions)
Exapmle:
FOR 1->A TO 1000 ISZ D NEXT
Makeing this I created the folowing table:
Prog -> 0.002 s
Goto -> 0.00132 s + 0.00006 s / Byte it jumps over.
(Goto +10 Bytes) -> +0.00063 s
(Goto +20 Bytes) -> +0.00124 s
Isz -> 0.00218 s
Dsz -> 0.00213 s
Locate imm,imm,imm -> 0.1126 s
Variable -> 0.0017 s
Imm8 -> 0.00209s
For loop -> 0.00554s
Recognicing this table the Prg COmmand would be effective as soon as you jump over more then 11 bytes(!)
Maybe I'll make a complete table sometimes. Who knows :-)
#27
Posted 21 August 2003 - 02:34 PM
Especially jump, condition and loop functions are affected by this...
#28
Posted 22 August 2003 - 03:16 AM
since I had no idea how to messure how long the way from the next to the for takes without needing proc cycles
on the commands between
#29
Posted 22 August 2003 - 06:53 AM
One thing I'm frustrated about is having to repeat codes in a program, I know you can split it up or use function memory and everything but I just want to be able to rewrite it so I only have it once. BASIC makes simple ideas SO hard to put into code. For example, what is the fastest way to check the values of the cell above, left, right and below a cell in a matrix?
#30
Posted 22 August 2003 - 07:00 AM
#31
Posted 22 August 2003 - 07:12 AM
You can't store commands in a program as far as I know. casiokingdom, if you could that would be one of the biggest breakthroughs yet, you could manipulate code within a program!!! The other breakthough would be to turn on your calc one day and a fully-functional Warcraft III appears on the screen.
#32
Posted 22 August 2003 - 09:47 AM
anyway, as for code rewriting itself, thats kinda been done... I wrote a language for casio basic to interprate, of course its insanely slow, but it has the ability to rewrite its self on the fly and its very hard to write in since its basically all numbers. now if someone were to make a C/ASM interface and executor then it could work out nicely...
Warcraft 3... ok, 3 weeks (j/k)
#33
Posted 23 August 2003 - 07:16 PM
And I have to divide my free time between this project and programming competition game (which I delayed for a week <_<)
It would be good for all of us to do this compiler, especially that it's mainly functions problem.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users